#!/bin/bash
#wget http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm  
#wget test.wgmf.com/mirrors/pg/pgdg-centos95-9.5-2.noarch.rpm
rpm -ivh pgdg-centos95-9.5-2.noarch.rpm
yum install -y postgresql95-server postgresql95-devel postgresql95-contrib  
export PATH=$PATH:/usr/pgsql-9.5/bin 
echo "export PATH=$PATH:/usr/pgsql-9.5/bin" >> /etc/profile
postgresql95-setup initdb 
sed -i '/^host/s/ident/md5/g' /var/lib/pgsql/9.5/data/pg_hba.conf
systemctl start postgresql-9.5.service  
cd /tmp
sudo -u postgres psql -c "CREATE DATABASE taiga;"
sudo -u postgres psql -c "CREATE USER taiga WITH PASSWORD 'J5brHrAXFLQSif0K';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE taiga TO taiga;"

